#pragma once

#include<iostream>
using std::cout;
using std::endl;

#define TYPE_STRING 1
#define TYPE_HASH 2
#define TYPE_LIST 3
#define TYPE_SET 4
#define TYPE_ZSET 5

#define TYPE_Encoding_SDS 1
#define TYPE_Encoding_INT 2
#define TYPE_Ecoding_HASHTABLE 3
#define TYPE_Ecoding_INTSET 4
#define TYPE_Ecoding_HASH 5
#define TYPE_Encoding_LIST 6
#define TYPE_Encoding_SKIPLIST 7

namespace redisStruct
{
	struct redisObject
	{
		int _type;
		int _encoding;
		int _refCount;
		redisObject(int type,int encoding):_type(type),_encoding(encoding),_refCount(1)
		{}
		void incrRefCount()
		{
			_refCount++;
		}
		void decrRefCount()
		{
			if (--_refCount == 0)
			{
				delete this;
			}
		}
		int getRefCount()
		{
			return _refCount;
		}
		virtual ~redisObject()
		{
			//cout << "~redisObject()" << endl;
		}
	};
}
